﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using System.Text.RegularExpressions;
using System.Globalization;

namespace KWIC
{
    /// <summary>
    /// 
    /// </summary>
    /// The following was created by mgsurya developed on the machineMGSURYA-PC on 12/4/2012, 9:34 AM
    public class NoiseElimator
    {
        /// <summary>
        /// Gets the NECS.
        /// </summary>
        /// <param name="TCSS">The TCSS.</param>
        /// <returns></returns>
        /// The following was created by mgsurya developed on the machineMGSURYA-PC on 12/4/2012, 9:34 AM
        public List<List<string>> getNECS(List<string> TCSS)
        {
            List<string> NETCSS = new List<string>();
            List<string> RemovedSentences = new List<string>();
            List<List<string>> NETCSSRS = new List<List<string>>();

            for (int i = 0; i < TCSS.Count(); i++)
            {
                String[] S = TCSS[i].Split(default(char[]));
                if (!(S[0].Equals("of") || S[0].Equals("the") || S[0].Equals("a") ||S[0].Equals("A") ||
                      S[0].Equals("Of") || S[0].Equals("oF") || S[0].Equals("OF") ||
                      S[0].Equals("The") || S[0].Equals("tHe") || S[0].Equals("thE") ||
                      S[0].Equals("THe") || S[0].Equals("tHE") || S[0].Equals("ThE") || S[0].Equals("THE")))
                {
                    NETCSS.Add(TCSS[i]);
                }
            }

            for (int i = 0; i < TCSS.Count(); i++)
            {
                String[] S = TCSS[i].Split(default(char[]));
                if ((S[0].Equals("of") || S[0].Equals("the") || S[0].Equals("a") || S[0].Equals("A") ||
                      S[0].Equals("Of") || S[0].Equals("oF") || S[0].Equals("OF") ||
                      S[0].Equals("The") || S[0].Equals("tHe") || S[0].Equals("thE") ||
                      S[0].Equals("THe") || S[0].Equals("tHE") || S[0].Equals("ThE") || S[0].Equals("THE")))
                {
                    RemovedSentences.Add(TCSS[i]);
                }
            }

            NETCSSRS.Add(NETCSS);
            NETCSSRS.Add(RemovedSentences);

            return NETCSSRS;
        }
    }
}